import java.io.*; 

public class Main { 
	public static int verbosity;
	public static int emulation;
	
	static public void main(String args[]) {    
		try { 

			scanner l = new scanner(new FileReader(args[0])); 
		
			if (args.length > 2){
				try {
		    		verbosity = Integer.parseInt(args[1].trim());
				emulation = Integer.parseInt(args[2].trim());
		    	} catch (NumberFormatException nfe) {
		    		System.out.println("Syntax Error: using default verbosity level and no emulation");
		    		verbosity = 1;
				emulation = 0;
		    	}
			}else{
	    		System.out.println("Using default verbosity level and no emulation");
				verbosity = 1;
				emulation = 0;
			}
			
			System.out.println("Verbosity level " + verbosity );
			
    		System.out.println("Reading from: " + args[0]);
    		
			/* Instantiate the parser */ 
			parser p = new parser(l); 
			
			/* Start the parser */ 
			Object result = p.parse(); 
			
		} catch (Exception e) { 
			e.printStackTrace(); 
		} 
	}
	
	static public int getVerbosity(){
		return verbosity;
	}
	static public int getEmulation(){
		return emulation;
	}

	public static String int2bin (int num){

		String str = Integer.toBinaryString(num).toString();

		if (verbosity > 0)
			System.out.println("-----------$ main - converted " + num + " to " + str);
	
		return str;
	}
} 



/* Message priority
 *--------------------------------------
 * 
 * 0 - status
 * 1 - status and parser (default)
 * 2 - status and parser detailed
 * 3 - status, parser detailed and scanner
 * 4 - status, parser detailed and scanner detailed
 *
 * errors and warnings are always printed
 */
